package Week6.J0524;

import java.util.Scanner;

public class 求和_xv {
    static int n, m, sum;
    static boolean[] chosen = new boolean[11];

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        m = scanner.nextInt();
        dfs(1);
    }

    private static void dfs(int x) {
        if (sum == m) {
            for (int i = 1; i <= n; i++) {
                if (chosen[i]) System.out.print(i + " ");
            }
            System.out.println();
            return; // 这条分支找到结果, 无需继续递归
        }
        if (x > n || sum > m) return;

        // 选 pos
        sum += x;
        chosen[x] = true;
        dfs(x + 1);
        // 恢复现场
        sum -= x;
        chosen[x] = false;
        // 不选 pos
        dfs(x + 1);
    }
}
